package com.ziyun.pop.modules.storeMaterials.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ziyun.pop.modules.storeMaterials.entity.ErpStockEntity;
import com.ziyun.pop.modules.storeMaterials.entity.StoreMaterialOutDetailEntity;
import com.ziyun.pop.modules.storeMaterials.entity.StorematerialinOutEntity;
import com.ziyun.pop.modules.supp.entity.SellerInfoEntity;
import io.renren.common.utils.R;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @Author ZhaoWei
 * @Date 2018/10/09 11:44
 * @Version V1.0
 */
@Mapper
@Repository
public interface StorematerialinOutDao extends BaseMapper<StorematerialinOutEntity> {

	List<SellerInfoEntity> getSelectMDList();

	StoreMaterialOutDetailEntity getOutMaterialDetail(@Param("outNo")String outNo,@Param("materialId")String materialId);

	BigDecimal getPricecost(@Param("materialId") String materialId,@Param("stockId") Integer stockId);

	BigDecimal getStockQuantity(@Param("materialId")String materialId,@Param("stockId")Integer stockId);

	void updateByMap(@Param("map") Map<String,Object> map, @Param("outId")Integer outId);


	Integer getSelectStockId(@Param("sellerId") Integer sellerId);

	List<StorematerialinOutEntity> getQueryList(@Param("params") Map<String, Object> params);

	int getqueryCount(@Param("params") Map<String, Object> params);

	ErpStockEntity getStockBySellerId(@Param("sellerId")Long sellerId, @Param("type")int type);

	/**
	 * 获取 库房出库单
	 * @param outNo
	 * @return
	 */
	StorematerialinOutEntity getStorematerialByNo(String outNo);


	BigDecimal getStoreStockByQuantity(@Param("materialId") String materialId,@Param("stockId") Integer stockId);

	@Select(" select * from store_material_out where out_id = #{outId} ")
	StorematerialinOutEntity getInfoData(@Param("outId") Integer outId);

	@Select(" select stock_id from store_material_out where out_id = #{outId} ")
	Integer getStockByOutId(@Param("outId") Integer outId);

	@Select(" select out_no from store_material_out where out_id = #{outId} ")
	String getOutNoByOutId(@Param("outId") Integer outId);

}
